import java.util.Random;
import java.util.Scanner;

/**
 * Menu类，处理主菜单相关的业务
 */
public class Menu {

    public Scanner scanner = new Scanner(System.in);

    public void menu(){
        System.out.println(
                "            >>主菜单\n" +
                        "           1. 幸运抽奖\n" +
                        "           2. 购物结算\n" +
                        "           3. 退出系统");

        String choose = scanner.next();
        switch (choose){
            case "1":
                //幸运抽奖
                luck();
                break;
            case "2":
                //购物结算
                shop();
                break;
            case "3":

                break;
        }
    }

    public void luck(){
        System.out.println("请输入4个数的账户：");
        int num = scanner.nextInt();

        //获取到了百位数
        int h = num % 1000 / 100;

        int r = new Random().nextInt(10);

        if(h == r){
            System.out.println("恭喜你，中奖了，获得MP3一个");
        }else{
            System.out.println("随机产生的幸运数为："+r+"，很遗憾，下次吧");

        }
    }

    public static void shop(){
        //实现
    }
}
